package com.resource.converter;

import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import com.resource.dto.CustomerSaveDto;
import com.resource.request.CustomerSaveRequest;

/**
 * 
 * 泛微系统请求对象转换
 * 
 * @Author: xiongbo.wan
 * @Date: 8:27 2020/9/24 0024
 */
@Mapper(componentModel = "spring")
public interface CustomerConverter {
    @Mappings({ @Mapping(source = "customer_id", target = "customerId"),
			@Mapping(source = "customer_name", target = "customerName"),
			@Mapping(source = "customer_number", target = "customerNumber"),
			@Mapping(source = "customer_manager", target = "customerManager"),
			@Mapping(source = "customer_service_manager", target = "customerServiceManager"),
			@Mapping(source = "customer_from", target = "customerFrom"),
			@Mapping(source = "customer_status", target = "customerStatus"),
			@Mapping(source = "customer_type", target = "customerType"),
			@Mapping(source = "customer_attribute", target = "customerAttribute"),
			@Mapping(source = "customer_industry", target = "customerIndustry"),
			@Mapping(source = "phone_number", target = "phoneNumber"), @Mapping(source = "fax_no", target = "faxNo"),
			@Mapping(source = "legal_person", target = "legalPerson"),
			@Mapping(source = "zip_code", target = "zipCode"),
			@Mapping(source = "customer_annual_sales", target = "customerAnnualSales"),
			@Mapping(source = "customer_introduce", target = "customerIntroduce"),
			@Mapping(source = "customer_area", target = "customerArea"),
			@Mapping(source = "created_at", target = "createdAt"),
			@Mapping(source = "customer_creator", target = "customerCreator"),
			@Mapping(source = "seas_group_id", target = "seasGroupId"),
			@Mapping(source = "last_contact_time", target = "lastContactTime"),
			@Mapping(source = "customer_license_name", target = "customerLicenseName"),
			@Mapping(source = "customer_attr", target = "customerAttr"),
			@Mapping(source = "main_customer", target = "mainCustomer"),
			@Mapping(source = "child_customer", target = "childCustomer"),
			@Mapping(source = "business_info", target = "businessInfo"),
			@Mapping(source = "unified_credit_code", target = "unifiedCreditCode"),
			@Mapping(source = "license_validity", target = "licenseValidity"),
			@Mapping(source = "is_main_customer", target = "isMainCustomer"),
			@Mapping(source = "registered_time", target = "registeredTime"),
			@Mapping(source = "last_update_time", target = "lastUpdateTime"),
			@Mapping(source = "associated_projects", target = "associatedProjects"),
			@Mapping(source = "associated_contracts", target = "associatedContracts"),
			@Mapping(source = "_text_customer_attr", target = "textCustomerAttr"),
			@Mapping(source = "_text_main_customer", target = "textMainCustomer"),
			@Mapping(source = "_text_child_customer", target = "textChildCustomer"),
			@Mapping(source = "_text_is_main_customer", target = "textIsMainCustomer"),
			@Mapping(source = "_text_associated_projects", target = "textAssociatedProjects"),
			@Mapping(source = "_text_associated_contracts", target = "textAssociatedContracts"),
			@Mapping(source = "_text_customer_manager", target = "textCustomerManager"),
			@Mapping(source = "_text_customer_service_manager", target = "textCustomerServiceManager"),
			@Mapping(source = "_text_customer_from", target = "textCustomerFrom"),
			@Mapping(source = "_text_customer_status", target = "textCustomerStatus"),
			@Mapping(source = "_text_customer_type", target = "textCustomerType"),
			@Mapping(source = "_text_customer_attribute", target = "textCustomerAttribute"),
			@Mapping(source = "_text_customer_industry", target = "textCustomerIndustry"),
			@Mapping(source = "_text_customer_area", target = "textCustomerArea"),
			@Mapping(source = "_text_customer_creator", target = "textCustomerCreator"),
			@Mapping(source = "_text_seas_group_id", target = "textSeasGroupId"),
			@Mapping(source = "_text_region", target = "textRegion"),

			@Mapping(source = "field_2", target = "field2"),
			@Mapping(source = "field_3", target = "field3"),
			@Mapping(source = "field_4", target = "field4"),
			@Mapping(source = "field_5", target = "field5"),
			@Mapping(source = "field_6", target = "field6"),
			@Mapping(source = "field_7", target = "field7"),
			@Mapping(source = "field_9", target = "field9"),
			@Mapping(source = "field_10", target = "field10"),
			@Mapping(source = "field_11", target = "field11"),
			@Mapping(source = "field_12", target = "field12"),
			@Mapping(source = "field_15", target = "field15"),
			@Mapping(source = "field_19", target = "field19"),
			@Mapping(source = "field_20", target = "field20"),
			@Mapping(source = "field_21", target = "field21"),


	})
    /**
     * request转换成dto
     *
     * @param request
     * @return
     */
	CustomerSaveDto requestToDto(CustomerSaveRequest request);

    /**
     * dto转换成request
     *
     * @param dto
     * @return
     */
    @InheritInverseConfiguration

    CustomerSaveRequest dtoToRequest(CustomerSaveDto dto);


}
